<template>
  <div>
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane
        v-for="(label, key) in data.tabConfig"
        :key="key"
        :label="label"
        :name="key"
      ></el-tab-pane>
    </el-tabs>
    <component :is="data.component[componentName]"></component>
  </div>
</template>

<script setup>
import { ref, reactive, markRaw, onMounted } from "vue";
import { useTreeStore } from "~/utils/pinia/tree.js";
import portStatus from "./components/portStatus.vue";
import secureBaseline from "./components/secureBaseline.vue";
const treeStore = useTreeStore();
treeStore.openTree();
const activeName = ref("portStatus");
const componentName = ref("portStatus");
const data = reactive({
  tabConfig: {
    portStatus: "端口状态",
    secureBaseline: "安全基线",
  },
  component: {
    portStatus: markRaw(portStatus),
    secureBaseline: markRaw(secureBaseline),
  },
});
onMounted(() => {});

const handleClick = (tab, event) => {
  componentName.value = tab.props.name;
};
</script>

<style lang="scss" scoped></style>
